/** init domain config */
import Vue from 'vue'
import Vant from 'vant';

import Storage from 'vue-ls'
import 'vant/lib/index.css';


import './config'
import App from './App.vue'
import router from './router'
import store from './store/'
import TabBar from '@/components/TabBar.vue'
import { VueAxios } from "@/utils/request"
import { List, DropdownMenu, DropdownItem } from 'vant';
// global字段控制
import global from './utils/global';
import busiConst from './utils/busiConst';

Vue.prototype.GLOBAL = global
Vue.prototype.BUSI_CONST = busiConst

// import VConsole from 'vconsole'
// const vConsole = new VConsole()
// Vue.use(vConsole)

// main.js
import { install } from 'vs-tree'
import 'vs-tree/dist/vs-tree.css'
Vue.use(install)


Vue.use(List);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);

// import Antd, { version } from 'ant-design-vue'
// console.log('ant-design-vue version:', version)

import Viser from 'viser-vue'
// import 'ant-design-vue/dist/antd.less';  // or 'ant-design-vue/dist/antd.less'

import '@/permission' // permission control
import '@/utils/filter' // base filter
// import Print from 'vue-print-nb-jeecg'
/*import '@babel/polyfill'*/
// import preview from 'vue-photo-preview'
// import 'vue-photo-preview/dist/skin.css'
import SSO from '@/cas/sso.js'
import {
  ACCESS_TOKEN,
  DEFAULT_COLOR,
  DEFAULT_THEME,
  DEFAULT_LAYOUT_MODE,
  DEFAULT_COLOR_WEAK,
  SIDEBAR_TYPE,
  DEFAULT_FIXED_HEADER,
  DEFAULT_FIXED_HEADER_HIDDEN,
  DEFAULT_FIXED_SIDEMENU,
  DEFAULT_CONTENT_WIDTH_TYPE,
  DEFAULT_MULTI_PAGE,
  INDEX_MAIN_PAGE_PATH
} from "@/store/mutation-types"
import config from '@/defaultSettings'
import NProgress from 'nprogress' // progress bar

// import JDictSelectTag from './components/dict/index.js'
import hasPermission from '@/utils/hasPermission'
import vueBus from '@/utils/vueBus';
// import JeecgComponents from '@/components/jeecg/index'
// import '@/assets/less/JAreaLinkage.less'
// import VueAreaLinkage from 'vue-area-linkage'
// import '@/components/jeecg/JVxeTable/install'
// import '@/components/JVxeCells/install'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
import F2 from '@antv/f2'
import "lib-flexible";
Vue.prototype.$F2 = F2;
Vue.config.productionTip = false;

Vue.use(Antd);
Vue.config.productionTip = false
Vue.use(Storage, config.storageOptions)
Vue.use(Vant)
Vue.use(VueAxios, router)
Vue.use(Viser)
Vue.use(hasPermission)
// Vue.use(JDictSelectTag)
// Vue.use(Print)
// Vue.use(preview)
Vue.use(vueBus);
// Vue.use(JeecgComponents);
// Vue.use(VueAreaLinkage);

Vue.component('TabBar', TabBar);

//关闭所有打印 
// console.log = function(){
//   return false;
// }

SSO.init(() => {
  main()
});
// router.afterEach((to, from) => {
//   router.push(to.path+'?dd_nav_bgcolor=FF3296FA&showmenu=false')
// })
function main() {
  new Vue({
    router,
    store,
    mounted() {
      store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
      store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme))
      store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout))
      store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader))
      store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar))
      store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth))
      store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader))
      store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak))
      store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor))
      store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
      store.commit('SET_MULTI_PAGE', Vue.ls.get(DEFAULT_MULTI_PAGE, config.multipage))
    },
    render: h => h(App)
  }).$mount('#app')
}
// var cordovaScript = document.createElement('script')
// cordovaScript.setAttribute('type', 'text/javascript')
// cordovaScript.setAttribute('src', 'cordova.js')
// document.body.appendChild(cordovaScript)